<?php

namespace App\Tables;

use Illuminate\Database\Eloquent\Model;

class OperationLog extends Model
{
    protected $table = 'operation_logs';

    protected $appends = ['level_text'];

    /**
     * 获取日志级别文字
     * @return mixed|string
     */
    public function getLevelTextAttribute()
    {
        switch ($this->level) {
            case 'info':
                return '信息';
            case 'error':
                return '错误';
            case 'debug':
                return '调试';
            case 'warn':
                return '警告';
            default:
                return $this->level;
        }
    }
}
